package io.renren.modules.base.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.R;
import io.renren.modules.base.entity.SysPushAd;
import io.renren.modules.base.service.impl.AdvertisementServiecImpl;


/**
 * @author kk
 */
@RestController
@RequestMapping("/api/v1/advertisement")
public class AdvertisementController {

	
	@Autowired
	AdvertisementServiecImpl advertisementServiecImpl;

	
	/**
	 * 广告查询
	 * @return
	 */
	@PostMapping("/query")
	public R queryAdvertisement() {
		List<SysPushAd> queryAdvertisement = advertisementServiecImpl.queryAdvertisement();
		SysPushAd yhSysPushAd = new SysPushAd();
		if(!queryAdvertisement.isEmpty()){
			yhSysPushAd = queryAdvertisement.get(0);
		}
		return R.reOk(yhSysPushAd);
	}
}
